var Comment=require('../lib/mongo.js').Comment;

module.exports={
    create:comment=>new Comment(comment).save(),
    getComments:postId=>Comment.find({postId:postId},null,{sort:{createdTime:-1}}),
    removeById:(commentId,author)=>Comment.remove({_id:commentId,author:author}),
    removeByPostId:postId=>Comment.remove({postId:postId})
};